// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   query.java

package include.query;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;

public class query
{

	private String dbase;
	private String tableName;
	private String timea;
	private String timeb;
	private String marketarea;
	private String sales;
	private String trade;
	private String fieldValue5;
	private String fieldName;
	private String fieldName1;
	private String fieldName2;
	private String fieldName3;
	private String fieldName4;
	private String fieldName5;
	private String realname;
	private String condition;
	private String queue;
	private String tagq;
	private String area1;
	private String area2;
	private String area3;
	private String sql;
	private String sql1;
	private String sql2;
	private String sql3;
	private String sql4;
	private String sql5;
	private String sql6;
	private String sql7;
	private nseer_db dba;
	private nseer_db dbb;
	private ResultSet rs;
	private ResultSet rs1;
	private ResultSet rs2;
	private ResultSet rs3;
	private ResultSet rs4;
	private ResultSet rs5;
	private ResultSet rs6;
	private ResultSet rs7;
	private int intRowCount;
	private double tradeTotal;
	private double profitTotal;
	private double netprofitTotal;
	private int backTimeTotal;
	private double bonus;

	public query()
	{
		dbase = "";
		tableName = "";
		timea = "";
		timeb = "";
		marketarea = "";
		sales = "";
		trade = "";
		fieldValue5 = "";
		fieldName = "";
		fieldName1 = "";
		fieldName2 = "";
		fieldName3 = "";
		fieldName4 = "";
		fieldName5 = "";
		realname = "";
		condition = "";
		queue = "";
		tagq = "";
		area1 = "";
		area2 = "";
		area3 = "";
		sql = "";
		sql1 = "";
		sql2 = "";
		sql3 = "";
		sql4 = "";
		sql5 = "";
		sql6 = "";
		sql7 = "";
		rs = null;
		rs1 = null;
		rs2 = null;
		rs3 = null;
		rs4 = null;
		rs5 = null;
		rs6 = null;
		rs7 = null;
		intRowCount = 0;
		tradeTotal = 0.0D;
		profitTotal = 0.0D;
		netprofitTotal = 0.0D;
		backTimeTotal = 0;
		bonus = 0.0D;
	}

	public ResultSet queryDB(String dbase, String tName, String uTimea, String uTimeb, String uMarketarea, String uSales, String uTrade, 
			String uValue, String fName1, String fName2, String fName3, String fName4, String fName5, String uCondition, 
			String uQueue, String rName)
	{
		this.dbase = dbase;
		tableName = tName;
		timea = uTimea;
		timeb = uTimeb;
		marketarea = uMarketarea;
		sales = uSales;
		trade = uTrade;
		fieldValue5 = uValue;
		fieldName1 = fName1;
		fieldName2 = fName2;
		fieldName3 = fName3;
		fieldName4 = fName4;
		fieldName5 = fName5;
		condition = uCondition;
		queue = uQueue;
		realname = rName;
		if (!timea.equals("") && timea.length() <= 10)
			timea = (new StringBuilder(String.valueOf(timea.substring(0, 10)))).append(" 00:00:00").toString();
		if (!timeb.equals("") && timeb.length() <= 10)
			timeb = (new StringBuilder(String.valueOf(timeb.substring(0, 10)))).append(" 23:59:59").toString();
		dba = new nseer_db(dbase);
		try
		{
			if (fieldValue5.equals(""))
			{
				if (timea.equals("") && timeb.equals("") && marketarea.equals("") && sales.equals("") && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && !timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName2).append("='").append(marketarea).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName4).append("='").append(sales).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && !timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && !timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && !timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && !timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && !timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && !timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && !timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && !timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && !timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (timea.equals("") && !timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
				else
				if (!timea.equals("") && timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(condition).append(" ").append(queue).toString();
				else
					sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(condition).append(" ").append(queue).toString();
			} else
			if (timea.equals("") && timeb.equals("") && marketarea.equals("") && sales.equals("") && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(condition).append("&&").append(fieldName5).append("='").append(fieldValue5).append("' ").append(queue).toString();
			else
			if (timea.equals("") && !timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && !timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && !timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && !timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && !timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && !timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && !timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && !timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && !timeb.equals("") && marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && !timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && !timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && timeb.equals("") && !marketarea.equals("") && (sales.equals("") || sales == null) && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (timea.equals("") && !timeb.equals("") && marketarea.equals("") && !sales.equals("") && sales != null && !trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append("<='").append(timeb).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
			if (!timea.equals("") && timeb.equals("") && !marketarea.equals("") && !sales.equals("") && sales != null && trade.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName2).append("='").append(marketarea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			else
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(fieldName1).append(">='").append(timea).append("' and ").append(fieldName4).append("='").append(sales).append("' and ").append(fieldName3).append("='").append(trade).append("' and ").append(fieldName5).append("='").append(fieldValue5).append("' and ").append(condition).append(" ").append(queue).toString();
			rs = dba.executeQuery(sql);
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return rs;
	}

	public int intRowCount()
	{
		try
		{
			dbb = new nseer_db(dbase);
			sql1 = sql;
			intRowCount = 0;
			rs1 = dbb.executeQuery(sql1);
			if (rs1.last())
				intRowCount = rs1.getRow();
			try
			{
				dbb.close();
			}
			catch (Exception ex)
			{
				ex.printStackTrace();
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return intRowCount;
	}

	public void close()
	{
		try
		{
			dba.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}

	public double sumTotal(String fName)
	{
		try
		{
			fieldName = fName;
			sql2 = sql;
			dbb = new nseer_db(dbase);
			rs2 = dbb.executeQuery(sql2);
			for (tradeTotal = 0.0D; rs2.next(); tradeTotal += rs2.getDouble(fieldName));
			try
			{
				dbb.close();
			}
			catch (Exception ex)
			{
				ex.printStackTrace();
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return tradeTotal;
	}

	public int intTotal(String fName)
	{
		try
		{
			fieldName = fName;
			dbb = new nseer_db(dbase);
			sql4 = sql;
			backTimeTotal = 0;
			for (rs4 = dbb.executeQuery(sql4); rs4.next();)
				backTimeTotal += rs4.getInt(fieldName);

			dbb.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return backTimeTotal;
	}
}
